package cn.dida.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.dida.dao.LogisticsDao;
import cn.dida.model.Logistics;
import cn.dida.model.Pageable;
import cn.dida.service.LogisticsService;
/**
 * <p>承运方   业务层接品实现类</p>
 * @author lisha
 * @date 2016-11-09 14:53
 * */
@Service
public class LogisticsServiceImpl implements LogisticsService {

	 @Autowired
	 private LogisticsDao logisticsDao;
	 
	@Override
	public Pageable<Logistics> queryLogistics(Integer companyId,String name, int page) {
		// TODO Auto-generated method stub
		return logisticsDao.query(companyId,name, page);
	}
	@Transactional
	@Override
	public Boolean insertLogistics(Logistics logistics) {
		// TODO Auto-generated method stub
		return logisticsDao.insert(logistics) == 1;
	}
	@Transactional
	@Override
	public Boolean updateLogistics(Integer companyId,Logistics logistics) {
		// TODO Auto-generated method stub
		return logisticsDao.update(companyId,logistics) == 1;
	}
	@Transactional
	@Override
	public Boolean deleteLogisticsByNumber(int id) {
		// TODO Auto-generated method stub
		return logisticsDao.delete(id) == 1;
	}

	@Override
	public Logistics getLogisticsById(Integer companyId,String name, int id) {
		// TODO Auto-generated method stub
		return logisticsDao.getLogisticsById(companyId,name, id);
	}

	@Override
	public List<Logistics> queryLogistics(Integer state) {
		// TODO Auto-generated method stub
		return logisticsDao.getLogisticsList(state);
	}

	@Override
	public boolean isExistsActivity(Integer companyId, String name) {
		// TODO Auto-generated method stub
		return logisticsDao.isExistsActivity(companyId, name);
	}

}
